Polygon = class()

function Polygon:init(vertices,u0,v0,u1,v1)
    self.vertices = vertices
    self.vertices[1]:remap(u0,v0)
    self.vertices[2]:remap(u1,v0)
    self.vertices[3]:remap(u1,v1)
    self.vertices[4]:remap(u0,v1)
    
end

function Polygon:render(t)
    t:color3f(1,1,1)
    local list = {1,2,3,3,4,1}
    for k,v in pairs(list) do
        local ver = self.vertices[v]
        t:vertexUV(ver.pos.x,ver.pos.y,ver.pos.z,ver.texCoord.x / 63.99,ver.texCoord.y / 31.99)
    end
end